package com.cskaoyan.demo3.config;

import com.cskaoyan.demo3.service.Animal;
import org.springframework.aop.framework.ProxyFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ComponentScan("com.cskaoyan.demo3")
public class SpringConfig {
    @Bean
    public ProxyFactoryBean AnimalProxy(Animal animal) {
        ProxyFactoryBean proxy = new ProxyFactoryBean();
        proxy.setTarget(animal);
        proxy.setInterceptorNames("logAdvice");
        return proxy;
    }
}
